s = "loveleetcode"
var firstUniqChar = function(s) {
    let a = -1
    

    for(let i=0;i<s.length;i++){
            let result = true
            let num = 0
        for(let j=0;j<s.length;j++){
            if(s[i]==s[j]){
                num++
            }
            if(num==2){
                result = false
                break
            }
        }

        if(result){
            return i
        }
    }  
    return a
};
console.log(firstUniqChar(s));
